package com.csun.nusing.util;

import android.content.Context;

import com.csun.nusing.bean.UrlBean;
import com.csun.nusing.bean.jsonbean.BaseJsonBean;
import com.google.gson.Gson;
import com.home.administrator.okhttplibrary.IOkTaskCallback;
import com.home.administrator.okhttplibrary.NetWorkUtil;
import com.home.administrator.okhttplibrary.OkHttpTask;

import java.util.HashMap;
import java.util.Map;

/**
 * 作者: Created by fzq on 2018/2/10 12:09
 * 邮箱: 15997123593@163.com
 */
public class PostLogUtils {

    /**
     * wifi上传log日志
     * @param context
     * @param Logcontent
     */
    public static void postLog(Context context,String Logcontent){

            //wifi
        if (NetWorkUtil.isWifiConnected(context)){
            if ((boolean)SPUtils.get(context,"upLogFlag",false)){
                String authorization = (String) SPUtils
                        .get(context, "authorization", "");
                Map<String, String> param = new HashMap<String, String>();
                param.put("log", "" + Logcontent);
                param.put("logtype", "0");
                OkHttpTask.newInstance(context).addHeader("authorization", authorization)
                        .enqueue(new IOkTaskCallback() {
                            @Override
                            public void onSuccess(String result) {
                            }
                        }).start(UrlBean.LOGUPDATEURL);
            }else{
            }
        }





    }


}
